package com.nlp.visualization.controller.jersey.error;

public enum ErrorCode {


    //请求参数错误,以1开头
    REQUEST_ARGUMENTS_ERROR("1001", "请求参数错误"),
    REQUEST_ARGUMENTS_MESSING_ERROR("1002", "缺少参数"),

    //未知错误
    OTHER_ERROR("999", "其他错误");

    private String errorCode;
    private String errorMsg;

    private String code;
    private String msg;

    private ErrorCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static String getResponseMsg(String code) {
        for (ErrorCode wrapperEnumError : ErrorCode.values()) {
            if (code.equals(wrapperEnumError.getCode())) {
                return wrapperEnumError.getMsg();
            }
        }
        return OTHER_ERROR.getMsg();
    }
}
